package com.bijava.taskjob;

import com.bijava.utils.LoggerFactoryUtil;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import org.slf4j.Logger;
import org.springframework.stereotype.Component;

@Component
public class MySimpleJob implements SimpleJob {
    private static final Logger log = LoggerFactoryUtil.get();

    @Override
    public void execute(ShardingContext shardingContext) {
        LoggerFactoryUtil.info(log,"当前线程：{}",Thread.currentThread().getId());
        LoggerFactoryUtil.info(log,"任务分片：{}",shardingContext.getShardingTotalCount());
        LoggerFactoryUtil.info(log,"当前分片：{}",shardingContext.getShardingItem());
        LoggerFactoryUtil.info(log,"分片参数：{}",shardingContext.getShardingParameter());
        LoggerFactoryUtil.info(log,"任务参数：{}",shardingContext.getJobParameter());
    }
}